package core

import (
	"gin-demo/sysinit"
	"log"

	"github.com/gin-gonic/gin"
)

// InitUploadRouters 初始化附件相关路由
func InitUploadRouters(router *gin.Engine, urlPrefix string) {
	c := UploadController{}
	coreRouters := router.Group(urlPrefix)
	{
		coreRouters.POST("/upload_multi", c.Multi)
		coreRouters.POST("/upload", c.Single)
	}
}

func init() {
	log.Println("init module core")
	InitUploadRouters(sysinit.Router, "/core")
	sysinit.DB.AutoMigrate(
		&Upload{},
	)
}
